﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Globalization;
using System.Threading;




namespace IDE_week2_Forms_project
{
    public partial class Form1 : Form
    {
        Icon currentIcon;
        int CurrentLanguage;
        public Form1()
        {
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("ro-MD");
            InitializeComponent();
            currentIcon = Icon;
            CurrentLanguage = 0;
        }

        private void btOpenNewForm_Click(object sender, EventArgs e)
        {
            Form2 f2 = new Form2();
            f2.Visible = true;
        }

        private void btChangeIcon_Click(object sender, EventArgs e)
        {
            this.Icon = Properties.Resources.Icon1;
        }

        private void btResetIcon_Click(object sender, EventArgs e)
        {
            this.Icon = currentIcon;
        }

        private void btChangeLanguage_Click(object sender, EventArgs e)
        {
            this.ChangeLanguage("en");
            CurrentLanguage++;
           
        }


        private void ChangeLanguage(string lang)
        {
            if (CurrentLanguage % 2 == 0)
            {
                foreach (Control c in this.Controls)
                {
                    ComponentResourceManager resources =
                          new ComponentResourceManager(typeof(Form1));
                            resources.ApplyResources(c, c.Name, new CultureInfo("en"));
                }
            }
            else
            {
                foreach (Control c in this.Controls)
                {
                    ComponentResourceManager resources =
                         new ComponentResourceManager(typeof(Form1));
                    resources.ApplyResources(c, c.Name, new CultureInfo("ro-MD"));
                }
            }
        }

        private void btCallClass_Click(object sender, EventArgs e)
        {
            int[] numbers = new int[10];
            Class1.MakeRandomNumber(numbers);
            label1.Text = numbers[0] + ", " + numbers[1] + ", " + numbers[2];

        }

       
    }
}
